package com.design.pattern.structure.decorator.mybatiscache.v1;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

public class BaseExecutor {
    public boolean openCache = true;

    public static Map<String, Object> cache = new ConcurrentHashMap<String, Object>();


    public void query(){
        if(openCache) {
            if(cache.containsKey("cacheKey")) {
                System.out.println("查询缓存");
            }else {
                System.out.println("查询数据库");
                cache.put("cacheKey", "result");
            }
        }else {
                System.out.println("查询数据库");
        }
    }
}
